<template>
	<view class="content">
		<uni-forms :label-width="105" ref="form" v-model="info" :rules="rules" validateTrigger="bind" @submit="submit">
			<uni-forms-item name="name" label="宝贝姓名" required><uni-easyinput v-model="info.name" :clearable="false" placeholder="请输入宝贝姓名" /></uni-forms-item>
			<uni-forms-item name="className" label="所在班级" required>
				<uni-data-select newText="班级" v-model="classIndex" :localdata="range" @change="changeClass"></uni-data-select>
			</uni-forms-item>
			<uni-forms-item name="date" label="检测日期" required>
				<picker
					style="line-height: 35px;
					background: #fff;padding-left: 10px;"
					mode="date"
					:value="info.date"
					@change="bindDateChange"
				>
					<view class="uni-input">{{ info.date }}</view>
				</picker>
			</uni-forms-item>
			<uni-forms-item name="time" label="检测时间" required>
				<picker
					style="line-height: 35px;
					background: #fff;padding-left: 10px;"
					mode="time"
					:value="info.time"
					@change="bindTimeChange"
				>
					<view class="uni-input">{{ info.time }}</view>
				</picker>
			</uni-forms-item>
			<uni-forms-item name="classId" label="检测类型" >
				<uni-data-select
				     newText="类型"
				     v-model="typeIndex"
				     :localdata="rangeType"
				     @change="changeIndex"
				 ></uni-data-select>
			</uni-forms-item>
			<uni-forms-item name="temperature" label="体温(℃)" required>
				<uni-easyinput v-model="info.temperature" :clearable="false" placeholder="请输入检测体温" />
			</uni-forms-item>
			<uni-forms-item name="handImg" label="手部图片" required>
				<image @click="clickImg(info.handImg)" style="width: 100px; height: 100px; background-color: #eeeeee;" mode="widthFix" :src="info.handImg"></image>
			</uni-forms-item>
			<uni-forms-item name="hand" label="手部检测状态" required>
				<radio-group @change="handleChange">
					<radio color="#1cb8a7" style="transform: scale(0.6);" value="0" :checked="info.nasalMucus == '0'" />
					不正常
					<radio color="#1cb8a7;" style="transform: scale(0.6);" value="1" :checked="info.nasalMucus == '1'" />
					正常
				</radio-group>
			</uni-forms-item>
			<uni-forms-item name="mouth" label="口腔图片:" required>
				<image style="width: 100px; height: 100px; background-color: #eeeeee;" mode="widthFix" :src="info.mouthImg"></image>
			</uni-forms-item>
			<uni-forms-item name="mouth" label="口腔检测状态" required>
				<radio-group @change="handleChange">
					<radio color="#1cb8a7;" style="transform: scale(0.6);" value="0" :checked="info.nasalMucus == '0'" />
					不正常
					<radio color="#1cb8a7;" style="transform: scale(0.6)" value="1" :checked="info.nasalMucus == '1'" />
					正常
				</radio-group>
			</uni-forms-item>
			<uni-forms-item name="mouth" label="眼部图片" required>
				<image style="width: 100px; height: 100px; background-color: #eeeeee;" mode="widthFix" :src="info.mouthImg"></image>
			</uni-forms-item>
			<uni-forms-item name="mouth" label="眼部检测状态" required>
				<radio-group @change="handleChange">
					<radio color="#1cb8a7;" style="transform: scale(0.6);" value="0" :checked="info.nasalMucus == '0'" />
					不正常
					<radio color="#1cb8a7;" style="transform: scale(0.6)" value="1" :checked="info.nasalMucus == '1'" />
					正常
				</radio-group>
			</uni-forms-item>
			<!-- <uni-forms-item name="mouth" label="是否流涕" required>
				<radio-group @change="handleChange">
					<radio color="#1cb8a7;" style="transform: scale(0.6)" value="0" :checked="info.nasalMucus == '0'" />
					是
					<radio color="#1cb8a7;" style="transform: scale(0.6)" value="1" :checked="info.nasalMucus == '1'" />
					否
				</radio-group>
			</uni-forms-item>
			<uni-forms-item name="mouth" label="指甲是否损伤" required>
				<radio-group @change="handleChange">
					<radio color="#1cb8a7;" style="transform: scale(0.6)" value="0" :checked="info.nasalMucus == '0'" />
					是
					<radio color="#1cb8a7;" style="transform: scale(0.6)" value="1" :checked="info.nasalMucus == '1'" />
					否
				</radio-group>
			</uni-forms-item>
			<uni-forms-item name="mouth" label="腮部是否正常" required>
				<radio-group @change="handleChange">
					<radio color="#1cb8a7;" style="transform: scale(0.6)" value="0" :checked="info.nasalMucus == '0'" />
					是
					<radio color="#1cb8a7;" style="transform: scale(0.6)" value="1" :checked="info.nasalMucus == '1'" />
					否
				</radio-group>
			</uni-forms-item>
			<uni-forms-item name="mouth" label="精神是否正常" required>
				<radio-group @change="handleChange">
					<radio color="#1cb8a7;" style="transform: scale(0.6)" value="0" :checked="info.nasalMucus == '0'" />
					是
					<radio color="#1cb8a7;" style="transform: scale(0.6)" value="1" :checked="info.nasalMucus == '1'" />
					否
				</radio-group>
			</uni-forms-item>
			<uni-forms-item name="mouth" label="是否咳嗽" required>
				<radio-group @change="handleChange">
					<radio color="#1cb8a7;" style="transform: scale(0.6)" value="0" :checked="info.nasalMucus == '0'" />
					是
					<radio color="#1cb8a7;" style="transform: scale(0.6)" value="1" :checked="info.nasalMucus == '1'" />
					否
				</radio-group>
			</uni-forms-item>
			<uni-forms-item name="mouth" label="是否有外伤" required>
				<radio-group @change="handleChange">
					<radio color="#1cb8a7;" style="transform: scale(0.6)" value="0" :checked="info.nasalMucus == '0'" />
					是
					<radio color="#1cb8a7;" style="transform: scale(0.6)" value="1" :checked="info.nasalMucus == '1'" />
					否
				</radio-group>
			</uni-forms-item> -->
			<uni-forms-item name="mouth" label="备注" required>
				<view class="uni-textarea"><textarea placeholder-style="color:#ccc" placeholder="请填写备注" /></view>
			</uni-forms-item>
		</uni-forms>
		<button
			style="width: 300rpx;
	background-color: #1cb8a7;
	color: #fff;
	margin-top: 100rpx;"
			@click="submit"
		>
			提交
		</button>
	</view>
</template>

<script>
import { pageClass } from '@/api/class.js';
export default {
	data() {
		return {
			info: {},
			rules: {},
			classIndex: 0,
			range: [],
			typeIndex:0,
			rangeType:[
				{value:0,
				text:'晨检'}
			],
		};
	},
	onLoad(op) {
		console.log('op', op);
		if (op.info.length) {
			this.info = JSON.parse(op.info);
		}
		this.pageClass();
	},
	methods: {
		changeIndex(e){
			this.typeIndex=e
		},
		changeClass() {},
		clickImg(url) {
			uni.previewImage({
				urls: [url], //需要预览的图片http链接列表，多张的时候，url直接写在后面就行了
				current: '', // 当前显示图片的http链接，默认是第一个
				success: function(res) {},
				fail: function(res) {},
				complete: function(res) {}
			});
		},
		pageClass() {
			pageClass({ pageSize: 100 }).then(
				res => {
					if (res.data.code == '0') {
						if (res.data.data.list.length) {
							res.data.data.list.forEach(bg => {
								this.range.push({ text: bg.className, value: bg.id });
							});
							console.log('班级获取', this.range);
							// this.screening.classId = this.range[0].value;
						} else {
							// this.$api.showTip(res.data.msg);
						}
					}
				},
				err => {
					this.$api.showTip('服务器错误');
				}
			);
		},
		bindTimeChange(e) {
			this.index = e.detail.value;
		},
		bindDateChange(e) {},
		handleChange(e) {
			console.log('eeeeeeeeee', e.detail.value);
		}
	}
};
</script>

<style lang="scss" scoped>
.content {
	padding: 30rpx 50rpx;
}
/deep/.uni-picker {
	line-height: 35px;
	background: #fff;
}
.uni-stat__select {
	padding: 0px !important;
}
.uni-stat__select > .uni-select {
	width: -webkit-fill-available !important;
	padding-left: 10px;
	font-size: 14px;
}
.uni-stat__select > .uni-select__input-text {
	width: 100%;
}

/deep/.uni-select__input-text {
	width: 191px;
	color: #333;
	font-size: 26rpx;
	white-space: nowrap;
	text-overflow: ellipsis;
	-o-text-overflow: ellipsis;
	overflow: hidden;
}
/deep/.uni-select {
	background-color: #fff;
}
.uni-textarea {
	background-color: #fff;
	width: 400rpx;
}
/deep/.uni-textarea-wrapper {
	font-size: 26rpx;
}
.uni-textarea-placeholder {
	font-size: 26rpx;
}
/deep/.uni-forms-item__content {
	line-height: 80rpx;
}
/deep/ .uni-button {
}
</style>
